<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录</title>
    <link rel="stylesheet" href="../../assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="../../assets/css/login.css?v=315">
    <link rel="stylesheet" href="../../assets/css/drag.css">
    <link rel="stylesheet" href="../../assets/module/admin.css?v=315">
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        if (window != top) {
            top.location.replace(location.href);
        }
    </script>
</head>
<body>
<div class="login-wrapper">
    <div class="login-header">
        <img src="../../assets/images/logo.png"> 物业管理系统
    </div>
    <div class="login-body">
        <div class="layui-card" style="opacity: 0.8">
            <div class="layui-card-header">
                <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;管理员登录
            </div>
            <form class="layui-card-body layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
                    <div class="layui-input-block">
                        <input name="email" type="text" placeholder="邮箱" class="layui-input"
                               lay-verType="tips" lay-verify="email" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
                    <div class="layui-input-block">
                        <input name="password" type="password" placeholder="密码" class="layui-input"
                               lay-verType="tips" lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
                    <div class="layui-input-block">
                        <div class="layui-row inline-block">
                            <div id="drag"></div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <button lay-filter="login-submit" id="submit" style="opacity:0.5;pointer-events:none;" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
                </div>
            </form>
        </div>
    </div>

</div>

<!-- js部分 -->
<script src="../../assets/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../assets/js/drag.js" type="text/javascript"></script>
<script type="text/javascript" src="../../assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="../../assets/js/common.js?v=315"></script>
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        $('#drag').drag();
        // 表单提交
        form.on('submit(login-submit)', function (obj) {
            $.ajax({
                type: "post",
                contentType: 'application/json',
                url: "/admin/loginByPassword",
                data: JSON.stringify(obj.field),
                dataType: 'json',
                success: function (data) {
                    if (data.code == '200') {
                        layer.msg('登录成功',
                            {
                                icon: 1,
                                time: 1500
                            }, function () {
                                location.replace('/index')
                            })
                    } else {
                        layer.alert(data.msg, {icon: 2}, function (index) {
                            layer.close(index);
                        });
                    }
                }
            })
            return false;
        });

    });
</script>
</body>
</html>
